Commit 28b13de5 authored by armin's avatar armin
Browse files

Merge branch 'android8Push' into 'master'

Android8 push

See merge request !174
parents debdc4af bff1cfa0
Pipeline #673 passed with stage
in 2 minutes and 19 seconds
......@@ -75,7 +75,7 @@ dependencies {
implementation('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6@aar') {
transitive = true
}
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
......
......@@ -46,7 +46,7 @@ import static android.app.Notification.DEFAULT_ALL;
public class FcmMessageReceiver extends FirebaseMessagingService {
public static final int NOTIFICATION_ID = 1;
public static final String TAG = "Ucom";
public static final String TAG = "RocketChatMobile";
private static NotificationManager mNotificationManager;
private static Notification.Builder builder;
public static int badgeCount = 0;
......@@ -136,7 +136,7 @@ public class FcmMessageReceiver extends FirebaseMessagingService {
int icon = appContext.getResources().getIdentifier("ic_stat_name","drawable",MainActivity.getAndroidPackageName(context));
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
new NotificationCompat.Builder(this,"channel0")
.setSmallIcon(icon)
.setColor(0x004f5d)
.setContentTitle(title)
......
......@@ -22,6 +22,7 @@ package com.osalliance.rocketchatMobile;
import android.app.Activity;
import android.Manifest;
import android.app.NotificationChannel;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
......@@ -146,7 +147,7 @@ public class MainActivity extends QtActivity {
}
MainActivity.window = this.getWindow();
MainActivity.view = new View(context);
MainActivity.setStatusBarColor(Color.parseColor("#314210"));
MainActivity.setStatusBarColor(Color.parseColor("#314210"));
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
......@@ -159,6 +160,8 @@ public class MainActivity extends QtActivity {
Intent intent = getIntent();
lastIntent = intent;
createNotificationChannel();
mNotificationManager = (NotificationManager)
this.getSystemService(Context.NOTIFICATION_SERVICE);
......@@ -166,6 +169,22 @@ public class MainActivity extends QtActivity {
}
private void createNotificationChannel() {
// Create the NotificationChannel, but only on API 26+ because
// the NotificationChannel class is new and not in the support library
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
CharSequence name = "RocketChatMobileNotificationChannel";
String description = "RocketChatMobile push notifications";
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel channel = new NotificationChannel("channel0", name, importance);
channel.setDescription(description);
// Register the channel with the system; you can't change the importance
// or other notification behaviors after this
NotificationManager notificationManager = getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);
}
}
public static void setStatusBarColor(String color){
final int colorInt = Color.parseColor(color);
m_instance.runOnUiThread(new Runnable() {
......@@ -306,7 +325,7 @@ public class MainActivity extends QtActivity {
return applicationInfo.packageName;
}
public static int checkCameraPermission() {
int permissionCheck = ContextCompat.checkSelfPermission(m_instance,
Manifest.permission.CAMERA);
......@@ -361,7 +380,7 @@ public class MainActivity extends QtActivity {
public static void setShortCutBadge() {
try {
ShortcutBadger.applyCount(context, FcmMessageReceiver.badgeCount);
} catch (Exception ex) {
//Log.i(TAG,ex.toString());
}
......@@ -540,7 +559,7 @@ public class MainActivity extends QtActivity {
@Override
public boolean onCreateThumbnail(Bitmap outBitmap, Canvas canvas)
{
return super.onCreateThumbnail(outBitmap, canvas);
return super.onCreateThumbnail(outBitmap, canvas);
}
@Override
......@@ -558,7 +577,7 @@ public class MainActivity extends QtActivity {
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
return super.onKeyDown(keyCode, event);
return super.onKeyDown(keyCode, event);
}
@Override
......@@ -588,7 +607,7 @@ public class MainActivity extends QtActivity {
@Override
public boolean onMenuOpened(int featureId, Menu menu)
{
return super.onMenuOpened(featureId, menu);
return super.onMenuOpened(featureId, menu);
}
@Override
......@@ -642,7 +661,7 @@ public class MainActivity extends QtActivity {
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu)
{
return super.onPreparePanel(featureId, view, menu);
return super.onPreparePanel(featureId, view, menu);
}
@Override
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment