Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

12 February, 2020

Work around for Broadcast receiver not working in Chinese mobiles

If you're having trouble with your Android app not responding to certain events in Mi, Oppo, Vivo or Letv devices it's not your fault.
This could include and is not limited to, service app not working properly, push notifications not working properly, application not opening up when intended. 
It is because of the extensive battery saver and the so-called saving the user from apps spamming their activity.

Here's the funniest part about it

We wrote to someone very senior at Xiaomi. He reverted that they manually whitelist a few apps, and the rest are by default disallowed from accessing the notifications folder. This was the response. "This usually happens because of whitelisting of apps that can access notifications folder. This is a feature to ensure the user is protected from spam and also helps to ensure RAM/battery usage optimization." We asked what the process was to get an app whitelisted, and did not get a response.  

This is coming from a post about GCM push notifications not working on Mi devices here.
https://stackoverflow.com/questions/40814126/gcm-push-notifications-for-android-devices-are-not-working-on-mi-and-letv-mobile/40932178#40932178

Funny because Chinese mobile manufacturers like Xiaomi, Oppo and Vivo first flood their phones with bloatware nobody asks for and even shove their useless articles and sponsored apps to users and here we see them talking about how they want to protect the user from spam and RAM and battery consumption.

The only solution is to get extensive permissions from the user which will be done manually and cannot be programmed for easiness.
What all permissions?
First, we need a permission to auto-start the application and then the permission to display pop-up window. 
App Settings > Permissions > Auto-Start
App Settings > Other Permissions > Display Pop-up

The most convenient workaround is to ask the user to manually permit these setting and open the settings page for the end-user.
This can be done by making a settings button that opens up the settings page.

settings = (Button)findViewById(R.id.settings);
settings.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                Uri uri = Uri.fromParts("package", getPackageName(), null);
                intent.setData(uri);
                startActivity(intent);
            }
        });

Useful links if you'd like to explore more.


31 December, 2019

Redirect users to new URL based on current URL


I'll be using JavaScript and the new feature called URLSearchParams for creating a new url out of the current URL and forward the user to it.
Why?
My use case was to forward my users to Google Play Store on Android using a link shared through Unity Android application. Now the Play Store link or Market link will not be detected as a browser request but regular text.
Market link looks like this: market://details?id=com.shiftescape.meowity&referrer=EFFX



This link when opened in computer web browser will lead to nothing. When opened in Google Chrome it would rather make a search.

Only other solution is to force the user's browser to open link and not do a search.

For this we'll be making a little website which will forward any visitor to our modified link retaining their referral code.

Initial Setup
XAMPP server installed and Apache module running.

For running our JavaScript code let's make a new web page index.html

<!DOCTYPE html>
<html>
<body>

<h2>Click the button</h2>
<p>Upon clicking you'll be forwarded to shiftescape.com</p>

<button onclick="forward()">Click me!</button>

<script>
var newUrl = "https://www.shiftescape.com";
function forward() {
  location.replace(newUrl)
}
</script>

</body>
</html> 


Now we need to grab the parameters from current url and add them to newUrl. For example if I open http://localhost/referid/?referrer=RX098787 it will still open the same page.
But I can use these get parameters to modify the newUrl I have to forward my users to.

To grab the parameters in url we will use URLSearchParams supported by Firefox 44+, Opera 36+, Edge 17+, Safari 10.3+ and Chrome 49+.

<!DOCTYPE html>
<html>
<body>

<h2>Click the button</h2>
<p>Upon clicking you'll be forwarded to shiftescape.com</p>

<button onclick="forward()">Click me!</button>

<script>

let params = new URLSearchParams(location.search);

var referralID = params.get('referrer');

//var newUrl = "market://details?id=com.shiftescape.meowity&referrer=" + referralID;
var newUrl = "http://www.shiftescape.com/referredBy=" + referralID;

function forward() {
  location.replace(newUrl)
}
</script>

</body>
</html> 


Now we also add a timeout for this method instead of clicking the button.

<!DOCTYPE html>
<html>
<body>

<p>You'll be redirected in a sec..</p>

<script>
setTimeout(function(){
           let params = new URLSearchParams(location.search);

var referralID = params.get('referrer');

//var newUrl = "market://details?id=com.shiftescape.meowity&referrer=" + referralID;
var newUrl = "http://www.shiftescape.com/referredBy=" + referralID;

location.replace(newUrl);

         }, 1000);
</script>

</body>
</html> 




That's it.
I commented out the newUrl part for forwarding users to Google Play Store as this cannot be tested on Chrome on PC.

For context and search visibility.
Redirect users to Google Playstore or App Store.
Custom redirect using JavaScript.
Change URL from current URL.
How to use URLSearchParams.




07 December, 2018

How to convert Oppo Real me 6 digit Passcode to 4 digit

To change the default 6 digit passcode or password to a 4 digit pin in Oppo phones,

Open Settings and click on Face and Passcode.



Then click on Privacy Code > ON to access further options.



Enter your current passcode and then click on Change Privacy Passcode.
 
Enter your current passcode and then click on Other Enncryption Methods. It is not visible in my screenshot as there is no way to take a screenshot of it.
After clicking Other ENcryption Methods you'll be able to see options to change it to 4 digit Numeric Passcode and other options.

09 March, 2017

Roblox for Xbox One

Apparently this is one of the Best free game you can find for Xbox One. I happen to have wasted 6 over hours today playing games on Xbox One and went on to play Roblox Speed Run for like 2 hours.


I also live streamed on Twitch for sometime and then on YouTube, needless to say I had little to no viewers.





Now what is Roblox?
Roblox is very much like Minecraft in game play and graphics style. It was launched way back in 2006 (yea I never heard of it) and now it is available on iOS, Android, Xbox One and Windows.
Roblox features game mods made by users and as their site claims it has over 15 million games created by users. It's best meant for kids and there are many addicting games like Speed Run which gets frustrating as you progress rather say when you don't progress.

 Roblox is Free To Play with in game purchases.

Roblox has a lot to be explored. It's massive user base leads to addition of new games and levels everyday. So yea unless you have really a lot of time to kill and can tolerate little bit of cliche of repetitiveness this is a game to go. Just 250 mb of download size in Xbox One won't take much time either.

I recommend playing Stop it, Slender! 2 which is a rip off of the popular Slender Man.

If you play this game and have any favorites you'd like me to play let me know in the comments.

See you in Live Stream. ;)

21 November, 2016

How to delete system apps from Android phone

System apps are neccessary apps that keeps the functionality of the phone intact. But in awe of sponsers most of the mobile companies load the phone with many useless apps which no one intends to use and they take up unneccesary space in the phone.
There is a way to delete such apps. But you need to root your android device for that to work.
This app called System app remover (ROOT) does the job really well.




I myself used it to remove the default cyanogen launcher Trebuchet and make Google Now Launcher my default afterwards. 

Featured Post

Content Writing VS Content Marketing: How are Both Different From Each Other?

Regardless of how long the businesses have been introduced to digital marketing, it is often seen that they confuse the terms of marketing. ...