Skip to content

Instantly share code, notes, and snippets.

@Nazmul56
Last active November 25, 2019 12:16
Show Gist options
  • Save Nazmul56/b62e2b5e8a795fb4c6686a2898046aab to your computer and use it in GitHub Desktop.
Save Nazmul56/b62e2b5e8a795fb4c6686a2898046aab to your computer and use it in GitHub Desktop.
##Target Module build.gradle
defaultConfig {
...
manifestPlaceholders = [pkgName: "com.ducomm"]
}
##Targate Module Mainfest.xml
...
<activity
android:name=".activity.SipIncomingActivity"
android:excludeFromRecents="true"
android:exported="true"
android:label="@string/title_activity_incoming_activity"
android:theme="@style/Details.NoActionBar">
<intent-filter>
<action android:name="${pkgName}.activity.SIPIncomingActivity.IN_CALL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
## From Another Module Class
Intent notificationIntent = new Intent();
notificationIntent.putExtra(C.SipKey.FROM_BACKGROUND_SIP_NOTIFICATION, true);
notificationIntent.setAction(C.PACKAGE_NAME + ".activity.SplashActivity.PENDING_CHAT");
PendingIntent pendingIntent = PendingIntent.getActivity(this,
0, notificationIntent, 0);
@JvmStatic
fun parsePhoneNumberForOii(phoneUtil: PhoneNumberUtil, phoneStr: String): String = try {
val pn1 = phoneUtil.parse(phoneStr, C.DEF_PHONE_REGION)
val pn2 = phoneUtil.parse("+$phoneStr", "ZZ")
val nm = phoneUtil.isNumberMatch(pn1, pn2)
val pn = if(nm==PhoneNumberUtil.MatchType.EXACT_MATCH) pn1 else pn2
var phoneStr2 = phoneUtil.format(pn, PhoneNumberUtil.PhoneNumberFormat.E164)
if (phoneStr2.startsWith("+")) phoneStr2 = phoneStr2.substring(1)
phoneStr2
} catch (e: Exception) {
e.printStackTrace()
// FIXME Decide default fail-over for any number
phoneStr
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment