This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<service android:name="your.native.namespace.GroupsJobIntentService" android:permission="android.permission.BIND_JOB_SERVICE" /> | |
<service android:name="your.native.namespace.FirebaseServiceExtended"> | |
<intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT"/> | |
</intent-filter> | |
</service> | |
<receiver android:name="your.native.namespace.GroupsReceiver"> </receiver> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(repliedNotifAcks == nil) | |
repliedNotifAcks = [[NSMutableArray alloc] init]; | |
your_namespace_MainClass_registerPushFromAfterFinishedLaunching__(CN1_THREAD_GET_STATE_PASS_SINGLE_ARG); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken { | |
const unsigned *tokenBytes = [deviceToken bytes]; | |
NSString *tokenAsString = [NSString stringWithFormat:@"%08x%08x%08x%08x%08x%08x%08x%08x", | |
ntohl(tokenBytes[0]), ntohl(tokenBytes[1]), ntohl(tokenBytes[2]), | |
ntohl(tokenBytes[3]), ntohl(tokenBytes[4]), ntohl(tokenBytes[5]), | |
ntohl(tokenBytes[6]), ntohl(tokenBytes[7])]; | |
JAVA_OBJECT str = fromNSString(CN1_THREAD_GET_STATE_PASS_ARG tokenAsString); | |
your_namespace_MainClass_iosPushRegistered___java_lang_String(CN1_THREAD_GET_STATE_PASS_ARG str); | |
} | |
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"aps": { | |
"content-available" : 1, | |
"alert": { | |
"title": title, | |
"body": body | |
}, | |
"badge": badgeCount, | |
"sound": "bingbong.aiff" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
.h file | |
*/ | |
#import <Foundation/Foundation.h> | |
#import <UserNotifications/UserNotifications.h> | |
@interface your_namespace_YourInterfaceImpl : NSObject<UNUserNotificationCenterDelegate> { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//foreground notifications | |
//feel free to remove params, this is just an example that passes APN meta fields to your app | |
public static void iosActivePushReceived(String notifId, String senderId) { | |
//do stuff. don't forget to encapsulate with Display's runSerially | |
} | |
public static void registerPushFromAfterFinishedLaunching() { | |
//call your native's interfcae registePush() method from here | |
} | |
public static void iosPushReceived(String notifId) { | |
//background push tapped. You could save the notifId/flag in a static field in your app so that your app knows it has to trigger some action in start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"message":{ | |
"<deviceToken>", | |
"data":{ | |
"messageType":"4", | |
"message":"title;body", | |
"notifId":"", | |
"senderId":"", | |
"hasImage":"" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String getPushIntent() | |
{ | |
String actionId = null; | |
if (com.codename1.impl.android.AndroidNativeUtil.getActivity() != null){ | |
Activity activity = com.codename1.impl.android.AndroidNativeUtil.getActivity(); | |
android.os.Bundle extras = activity.getIntent().getExtras(); | |
if (extras != null) { | |
actionId = extras.getString("pushAction"); | |
extras.remove("pushAction"); | |
activity.setIntent(new Intent()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.firebase.messaging.RemoteMessage; | |
import android.app.NotificationManager; | |
import android.app.Activity; | |
import android.content.Intent; | |
import android.app.PendingIntent; | |
import android.graphics.Bitmap; | |
import android.graphics.drawable.BitmapDrawable; | |
import android.graphics.drawable.Drawable; | |
import android.support.v4.app.NotificationCompat.Builder; | |
import android.support.v4.app.NotificationCompat; |
NewerOlder