Skip to content

Commit

Permalink
renamed the example, so it's not misspelled.
Browse files Browse the repository at this point in the history
  • Loading branch information
JimSeker committed Oct 23, 2018
1 parent 131d610 commit 31b2d1f
Show file tree
Hide file tree
Showing 54 changed files with 349 additions and 158 deletions.
Binary file removed BoradcastBoot2/.idea/caches/build_file_checksums.ser
Binary file not shown.
9 changes: 0 additions & 9 deletions BoradcastBoot2/.idea/modules.xml

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 0 additions & 6 deletions BoradcastBoot2/app/src/main/res/values/colors.xml

This file was deleted.

Binary file removed BoradcastBoot2/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion BoradcastBoot2/.gitignore → BroadcastBoot2/.gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/caches/build_file_checksums.ser
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
.DS_Store
/build
/captures
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 27

compileSdkVersion 28
defaultConfig {
applicationId "edu.cs4730.boradcastboot2"
minSdkVersion 16
targetSdkVersion 27
applicationId "edu.cs4730.broadcastboot2"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
Expand All @@ -21,7 +19,6 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-compat:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Android\android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http:https://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http:https://schemas.android.com/apk/res/android"
package="edu.cs4730.boradcastboot2">

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
package="edu.cs4730.broadcastboot2">

<application
android:allowBackup="true"
Expand All @@ -13,25 +11,11 @@
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

<receiver
android:name=".MyReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

<service
android:name=".MyJobIntentService"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package edu.cs4730.boradcastboot2;
package edu.cs4730.broadcastboot2;

import android.app.NotificationChannel;
import android.app.NotificationManager;
Expand All @@ -9,6 +9,7 @@
import android.util.Log;

public class MainActivity extends AppCompatActivity {

final String TAG = "MainActivity";
public static String id = "test_channel_01";
MainFragment mFragment;
Expand All @@ -28,10 +29,10 @@ protected void onCreate(Bundle savedInstanceState) {

if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, mFragment).commit();
.add(R.id.container, mFragment).commit();
} else {
getSupportFragmentManager().beginTransaction()
.replace(R.id.container, mFragment).commit();
.replace(R.id.container, mFragment).commit();
}


Expand All @@ -40,15 +41,15 @@ protected void onCreate(Bundle savedInstanceState) {
}


/*
* for API 26+ create notification channels
*/
/**
* for API 26+ create notification channels
*/
private void createchannel() {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
NotificationChannel mChannel = new NotificationChannel(id,
getString(R.string.channel_name), //name of the channel
NotificationManager.IMPORTANCE_DEFAULT); //importance level
getString(R.string.channel_name), //name of the channel
NotificationManager.IMPORTANCE_DEFAULT); //importance level
//important level: default is is high on the phone. high is urgent on the phone. low is medium, so none is low?
// Configure the notification channel.
mChannel.setDescription(getString(R.string.channel_description));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package edu.cs4730.boradcastboot2;
package edu.cs4730.broadcastboot2;

import android.content.Intent;
import android.os.Bundle;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package edu.cs4730.boradcastboot2;
package edu.cs4730.broadcastboot2;

import android.app.Notification;
import android.app.NotificationManager;
Expand All @@ -15,7 +15,6 @@

/**
* Likely I should have created an infinite process here. but it seems to work.
*
*/
public class MyJobIntentService extends JobIntentService {
/**
Expand All @@ -35,7 +34,7 @@ protected void onHandleWork(Intent intent) {
// We have received work to do. The system or framework is already
// holding a wake lock for us at this point, so we can just go.
int NotiID = 1;
while(true) {
while (true) {
sendNoti(getApplicationContext(), NotiID);
Log.wtf("JobSheduler", "send notification");
try {
Expand Down Expand Up @@ -97,18 +96,17 @@ public void sendNoti(Context context, int notiID) {

//create the notification
Notification notif = new NotificationCompat.Builder(context, MainActivity.id)
.setSmallIcon(R.mipmap.ic_launcher)
.setWhen(System.currentTimeMillis()) //When the event occurred, now, since noti are stored by time.
.setContentTitle("New headline!") //Title message top row.
.setContentText(info) //message when looking at the notification, second row
.setContentIntent(contentIntent) //what activity to open.
.setChannelId(MainActivity.id)
.setAutoCancel(true) //allow auto cancel when pressed.
.build(); //finally build and return a Notification.
.setSmallIcon(R.mipmap.ic_launcher)
.setWhen(System.currentTimeMillis()) //When the event occurred, now, since noti are stored by time.
.setContentTitle("New headline!") //Title message top row.
.setContentText(info) //message when looking at the notification, second row
.setContentIntent(contentIntent) //what activity to open.
.setChannelId(MainActivity.id)
.setAutoCancel(true) //allow auto cancel when pressed.
.build(); //finally build and return a Notification.
//Show the notification
mManager.notify(1, notif); //and if we want different notifications, use notiID here instead of 1.
}



}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package edu.cs4730.boradcastboot2;
package edu.cs4730.broadcastboot2;

import android.content.BroadcastReceiver;
import android.content.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<vector xmlns:android="http:https://schemas.android.com/apk/res/android"
xmlns:aapt="http:https://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0"/>
<item
android:color="#00000000"
android:offset="1.0"/>
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000"/>
</vector>
Loading

0 comments on commit 31b2d1f

Please sign in to comment.