Gradle script xml transformation - android

I'm writting a gradle script and i need to modify my androidManifest in this script.
I don't know how to do that, i need to change 2 properties in this manifest.
I have tried to use a regEx with a ant.replaceregexp but i can't write my regEx to replace only the android:name of the activity node.
There is a better way to modify it or no ?
Maybe i can use a XML parser but i don't know how to write my file after.
Here you can find my manifest :
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="10402" android:versionName="1.4.2" android:windowSoftInputMode="adjustPan" package="com.yyyyyy.xxxxxx" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:debuggable="true" android:hardwareAccelerated="true" android:icon="#drawable/icon" android:label="#string/app_name">
<!--GradleActivity--><activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="#string/app_name" android:launchMode="singleTop" android:name="xxxxxx" android:screenOrientation="portrait" android:theme="#android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="com.yyyyyy.xxxxxx.TrackingService">
</service>
<receiver android:name="com.yyyyyy.xxxxxx.BootCompletedIntentReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<activity android:exported="true" android:name="com.plugin.gcm.PushHandlerActivity" />
<receiver android:name="com.plugin.gcm.CordovaGCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.yyyyyy.xxxxxx" />
</intent-filter>
</receiver>
<service android:name="com.plugin.gcm.GCMIntentService" />
</application>
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="18" />
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.PREVENT_POWER_KEY" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<permission android:name="com.yyyyyy.xxxxxx.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.yyyyyy.xxxxxx.permission.C2D_MESSAGE" />
</manifest>
I want to change the " < activity> =>android:name = xxxxx" property to " < activity> =>android:name = zzzzzzz"
Thanks.

You can use this regex with groups:
/(<activity.*android:name=")(\w+)(.*">)/gm
And this subtitution:
\1zzzzz\3
Link:
https://regex101.com/r/vI7sK3/5

Related

Error:(45) Error: The <supports-screens> element must be a direct child of the <manifest> root element [WrongManifestParent]

I'm trying to fix this error but I do not fully understand what is wrong. It runs well on the emulator but starts giving me a problem when I'm trying to do a signed apk.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ntokozo.taxicalculator">
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.WRITE_SMS" />
<uses-permission android:name="android.permission.SMS_DELIVER_ACTION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".Logo">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Main2Activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name=".MainActivity">
<supports-screens android:compatibleWidthLimitDp="320" />
</activity>
</application>
Either delete this line:
<supports-screens android:compatibleWidthLimitDp="320" />
Or move it outside of <activity>, so it is a direct child of the root <manifest> element:
<activity android:name=".MainActivity">
</activity>
<supports-screens android:compatibleWidthLimitDp="320" />

ERROR getting 'name' attribute: attribute is not a string value Hybrid Cordova App

I am new to Hybrid Android applications using Cordova and salesforce.
I have built a signed APK and ZipAligned it.
But when I am uploading it to app store it gives me following error:
Following is my Manifest file:
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="1.0.1" package="com.thehub.app" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="23" />
<permission android:name="com.thehub.app.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_SERVICE" />
<uses-permission android:name="com.thehub.app.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<application android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="#drawable/thehub"
android:label="#string/app_name"
android:manageSpaceActivity="com.salesforce.androidsdk.ui.ManageSpaceActivity" >
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
android:label="#string/app_name"
android:launchMode="singleTop"
android:name="com.salesforce.androidsdk.ui.sfhybrid.SalesforceDroidGapActivity"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:label="#string/app_name" android:name="com.synconset.MultiImageChooserActivity" android:screenOrientation="portrait" android:theme="#android:style/Theme.Holo.Light">
<intent-filter />
</activity>
<activity android:exported="true" android:label="#string/app_name" android:name="com.plugin.gcm.PushHandlerActivity" android:screenOrientation="portrait" />
<receiver android:name="com.plugin.gcm.CordovaGCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.thehub.app" />
</intent-filter>
</receiver>
<service android:name="com.plugin.gcm.GCMIntentService" />
</application>
</manifest>
I am not able to locate where in the Manifest file I am doing it wrong.
Any help is appreciated.
Thanks in advance.
Got the answer from this post
http://salesforce.stackexchange.com/questions/69566/mobile-sdk-android-aapt-error
In the SalesforceSDK plugin
Just changed the
android:name="#string/app_package"
to
android:name="com.salesforce.androidsdk"

Android Sip application call from Contacts / PhoneBook

I'm currently developing an application using sip which is actually working.
However, I would like to allow people to call from "PhoneBook/Contact",
I saw a few application, like csip simple, where it works. I can click on the phone number, then a little dialog box appears and I can choose between several application.
I already did some research on StackOverflow and I found one solution which does not work.
I wonder if I made a mistake in my manifest, could you help me ?
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="com.example.SIPProject" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<application android:hardwareAccelerated="true" android:icon="#drawable/icon" android:label="#string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="#string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="#android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="#string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:priority="10">
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.DIAL" />
<action android:name="android.intent.action.CALL" />
<action android:name="android.intent.action.DIALER" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<data android:scheme="tel" />
</intent-filter>
</activity>
<service android:name="com.example.sip.SipManagerService" />
<receiver android:name="com.example.sip.SipOnboot">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
</application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="22" />
<service android:name="com.example.sip.SipManagerService" />
<receiver android:name="com.example.sip.SipOnboot">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<uses-permission android:name="android.permission.CALL_PRIVILEGED" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.CONFIGURE_SIP" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-feature android:name="android.hardware.telephony" android:required="true" />
<uses-permission android:name="android.permission.USE_SIP" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<use-feature android:name="android.hardware.sip.voip" android:required="true" />
<use-feature android:name="android.hardware.wifi" android:required="true" />
<use-feature android:name="android.hardware.microphone" android:required="true" />
</manifest>
Thanks
For SIP calls, i think the data type should be like this
<data android:scheme="sip" />
For reference check this
SipDroid

Register DeviceId with Unity Native Plugin

I'm using Unity Native Plugin library to implement GCM. When i try to get register device id i don't receive either fail or success response. i don't receive anything at all. my manifest file:
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="preferExternal" package="my_package_name"
android:versionName="2.0" android:versionCode="2">
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
<uses-feature android:glEsVersion="0x00020000" />
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<permission android:name="my_package_name.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="my_package_name.permission.C2D_MESSAGE" />
<application>
<receiver
android:name="com.androidnative.gcm.GcmBroadcastReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="my_package_name" />
</intent-filter>
</receiver>
<service android:name="com.androidnative.gcm.GcmIntentService"/>
<activity android:name="com.androidnative.billing.core.AN_BillingProxyActivity" android:launchMode="singleTask" android:label="#string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<activity android:name="com.androidnative.AndroidNativeProxy" android:launchMode="singleTask" android:label="#string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="#string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" />
<activity android:name="com.facebook.LoginActivity" android:label="#string/app_name" android:theme="#android:style/Theme.Translucent.NoTitleBar" android:configChanges="keyboardHidden|orientation" />
<activity android:name="com.facebook.unity.FBUnityLoginActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" />
<activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true" />
<activity android:name="com.facebook.unity.FBUnityDialogsActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" />
</application>
</manifest>
Could you help me to setup it correctly? Is it connected with manifest?

NFC auto-open android application

I have been instructed to get an NFC tag to open an app that I'm creating using phonegap and I'm adding the following code to my AndroidManifest.xml file.
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http"
android:host="hesdev.nixtel.com"
android:pathPrefix=""
android:priority="1000"
/>
</intent-filter>
I want the NFC tag to open the app and bring it to the front. A URL similar to this is written to my tag:
hesdev.nixtel.com?nfc=kj43hg4g32o2j34hb3g43j453
My question is why is it not working for me? When I scan the NFC tag it should open my application right? It isn't. It opens the web-browser on the tab and brings me to said URL.
edit
This is my full manifest file...
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.healthe_scan"
android:versionCode="1"
android:versionName="1.0" >
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<!--uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/-->
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.healthe_scan.MainActivity"
android:label="#string/app_name"
android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http"
android:host="hesdev.nixtel.com"
android:pathPrefix=""
android:priority="1000"
/>
</intent-filter>
</activity>
<activity
android:name="org.apache.cordova.DroidGap"
android:label="#string/app_name"
android:configChanges="orientation|keyboardHidden">
<intent-filter></intent-filter>
</activity>
</application>
</manifest>
~7 hours down the drain...
There was nothing wrong with the code- it was my tags that weren't working properly. Whatever my tag writer was doing it would open the browser and direct it to the designated URL but wasn't starting the app. I changed my tag writer to this one...
https://play.google.com/store/apps/details?id=com.nxp.nfc.tagwriter&hl=en
and it worked straight away.

Categories

Resources