Skip to content

Commit 6cebea5

Browse files
committed
Using pending intent so we get waken up when share is done
YM-15454
1 parent af8e725 commit 6cebea5

File tree

5 files changed

+42
-6
lines changed

5 files changed

+42
-6
lines changed

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ supportLibraryVersion=25.3.1
3232
libJunitVersion=4.12
3333
libMockitoVersion=1.10.19
3434

35-
currentVersion=1.0.0
36-
currentVersionCode=000007
35+
currentVersion=1.1.0
36+
currentVersionCode=000008
3737
currentAppName=Mobile Button SDK
3838
artefactName=yoti-button-sdk
3939

yoti-sdk/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
android:allowBackup="true"
77
android:label="@string/app_name"
88
android:supportsRtl="true">
9+
<activity android:name=".ReceiverActivity" android:theme="@style/Theme.AppCompat.Translucent"/>
910
<service
1011
android:name=".kernelSDK.KernelSDKIntentService"
1112
android:exported="false"/>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.yoti.mobile.android.sdk;
2+
3+
import android.content.Intent;
4+
import android.os.Bundle;
5+
import android.support.v7.app.AppCompatActivity;
6+
7+
public class ReceiverActivity extends AppCompatActivity {
8+
9+
@Override
10+
protected void onCreate(Bundle savedInstanceState) {
11+
super.onCreate(savedInstanceState);
12+
13+
Intent intent = new Intent(getIntent().getAction());
14+
intent.setPackage(getIntent().getPackage());
15+
intent.putExtras(getIntent().getExtras());
16+
17+
sendBroadcast(intent);
18+
19+
finish();
20+
}
21+
}

yoti-sdk/src/main/java/com/yoti/mobile/android/sdk/kernelSDK/KernelSDKIntentService.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
package com.yoti.mobile.android.sdk.kernelSDK;
22

33
import android.app.IntentService;
4+
import android.app.PendingIntent;
45
import android.content.Context;
56
import android.content.Intent;
67
import android.content.pm.ApplicationInfo;
78
import android.net.Uri;
89
import android.os.ResultReceiver;
910
import android.text.TextUtils;
1011

12+
import com.yoti.mobile.android.sdk.ReceiverActivity;
1113
import com.yoti.mobile.android.sdk.YotiSDK;
1214
import com.yoti.mobile.android.sdk.YotiSDKLogger;
1315
import com.yoti.mobile.android.sdk.model.Scenario;
1416

1517
import java.io.IOException;
16-
import java.security.KeyManagementException;
17-
import java.security.KeyStoreException;
18-
import java.security.NoSuchAlgorithmException;
19-
import java.security.cert.CertificateException;
2018

2119
import static com.yoti.mobile.android.sdk.YotiAppDefs.YOTI_APP_PACKAGE;
2220
import static com.yoti.mobile.android.sdk.YotiSDKDefs.APP_ID_PARAM;
@@ -38,6 +36,7 @@ public class KernelSDKIntentService extends IntentService {
3836
private static final String ACTION_BACKEND_CALL = "com.yoti.mobile.android.sdk.network.action.BACKEND_CALL";
3937
private static final String ACTION_START_SCENARIO = "com.yoti.mobile.android.sdk.network.action.START_SCENARIO";
4038
private static final String YOTI_CALLED_RESULT_RECEIVER = "com.yoti.mobile.android.sdk.network.action.YOTI_CALLED_RESULT_RECEIVER";
39+
public static final String YOTI_PENDING_INTENT_EXTRA = "YOTI_PENDING_INTENT_EXTRA";
4140

4241
private static final String EXTRA_USE_CASE_ID = "com.yoti.mobile.android.sdk.network.extra.USE_CASE_ID";
4342
private KernelSDK mKernelSDK;
@@ -140,6 +139,11 @@ private void handleActionStartScenario(String useCaseId, ResultReceiver resultRe
140139
intent.setData(uri);
141140
}
142141

142+
Intent wakeupIntent = new Intent(this, ReceiverActivity.class);
143+
PendingIntent pendingIntent = PendingIntent.getActivity(this, 1, wakeupIntent, PendingIntent.FLAG_UPDATE_CURRENT);
144+
145+
intent.putExtra(YOTI_PENDING_INTENT_EXTRA, pendingIntent);
146+
143147
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
144148
startActivity(intent);
145149
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<style name="Theme.AppCompat.Translucent" parent="Theme.AppCompat.NoActionBar">
4+
<item name="android:background">#00000000</item>
5+
<item name="android:windowNoTitle">true</item>
6+
<item name="android:windowBackground">@android:color/transparent</item>
7+
<item name="android:colorBackgroundCacheHint">@null</item>
8+
<item name="android:windowIsTranslucent">true</item>
9+
</style>
10+
</resources>

0 commit comments

Comments
 (0)