• April 27, 2024, 11:45:09 am

Author Topic: HAL Device UID check  (Read 6264 times)

0 Members and 1 Guest are viewing this topic.

Offline Allstar12345

  • Allstar Software Founder
  • Administrator
  • Forum Genius
  • ******
  • Posts: 5,235
  • Reputation: 812
    • Allstar Software
  • Current Phone: : OnePlus 8 Pro, Xperia 10, Nexus 6p, Jolla Phone, Nokia N8, Nokia 808 PureView, BlackBerry Z30
HAL Device UID check
« on: February 18, 2014, 04:45:23 pm »
This is handy for any devs who want to stop certain devices from using an App, since there is always someone who tries a App which isn't for their phone regardless of the what the developer says.

First you need to include the following:

Code: [Select]
#include <HAL.h>
#include <hal_data.h>

Next you define the devices and their UID's:
Here is the complete list from Nokia (includes non Nokia s60 devices):
http://developer.nokia.com/community/wiki/S60_Platform_and_device_identification_codes

Define them like this:
Code: [Select]
#define C6 0x2002376a
#define C7 0x2002bf92
#define E7 0x2002bf96
#define N8 0x20029a73
#define X7 0x20029a6f

Next you have the actual check itself:

Code: [Select]
bool checkDevice()
{
    TInt uid = 0;
    HAL::Get(HAL::EMachineUid, uid);
    if( uid == C6 || uid == C7 || uid == E7 || uid == N8 || uid == X7 )
        {
            return true;
        }
    else
        {
            return false;
        }
}

Seperating the devices with
Code: [Select]
||

Then a basic way, if it returns true then this is called:

Code: [Select]
  if(checkDevice())
    {
        //Do whatever you please here
    }



Note, you may encounter issues when exposing a class to QML, for some reason it stopped one of mine from loading, so I recommend leaving the check till last when the App loads.

Offline MoritzJT

  • Developer
  • New Member
  • ****
  • Posts: 16
  • Reputation: 1
  • Symbian Power User
  • Current Phone: : N95-1, N8-00, N900, N9, 808
Re: HAL Device UID check
« Reply #1 on: February 18, 2014, 06:55:05 pm »
Nice concept. Could you explain to me in detail why it's beneficial for a developer?

Is it to avoid support requests from unsupported platforms?

Because in some cases apps DO work on non-deployed-to devices. Ofc you can employ this method if you are absolutely certain that it cannot run in any other environment than the ones specified.

But I have to say I'd like any dev to refrain from using such tactics just to avoid spreading and porting efforts to other platforms.

Offline Allstar12345

  • Allstar Software Founder
  • Administrator
  • Forum Genius
  • ******
  • Posts: 5,235
  • Reputation: 812
    • Allstar Software
  • Current Phone: : OnePlus 8 Pro, Xperia 10, Nexus 6p, Jolla Phone, Nokia N8, Nokia 808 PureView, BlackBerry Z30
Re: HAL Device UID check
« Reply #2 on: February 18, 2014, 07:03:32 pm »
Nice concept. Could you explain to me in detail why it's beneficial for a developer?

Is it to avoid support requests from unsupported platforms?

Because in some cases apps DO work on non-deployed-to devices. Ofc you can employ this method if you are absolutely certain that it cannot run in any other environment than the ones specified.

But I have to say I'd like any dev to refrain from using such tactics just to avoid spreading and porting efforts to other platforms.

Well it can be used in a few ways, one to stop a App runnning on a device it wasn't made for, like an App just the 808 PureView, so other users don't try and use it. (Like a App just for it's PureView Camera)

To change things to suite certain devices, I used to use it to load a different QML file for first and second gen Symbian^3 phones in early versions of Star Browser.

It's not going to stop Apps being ported, it's compiled code, it wouldn't run on another platform without the source code anyway :)
« Last Edit: February 18, 2014, 07:53:11 pm by Allstar12345 »

Offline matthew

  • Mass Poster
  • ****
  • Posts: 1,315
  • Reputation: 13
  • SymphonyOS
  • Current Phone: :
    N8-00 (25.007)
    808 (113.010.1508)
    Retired E72, E6-00
Re: HAL Device UID check
« Reply #3 on: February 18, 2014, 07:43:33 pm »
HEY! i like trying incompatible software - it's my thing :D

Offline Allstar12345

  • Allstar Software Founder
  • Administrator
  • Forum Genius
  • ******
  • Posts: 5,235
  • Reputation: 812
    • Allstar Software
  • Current Phone: : OnePlus 8 Pro, Xperia 10, Nexus 6p, Jolla Phone, Nokia N8, Nokia 808 PureView, BlackBerry Z30
Re: HAL Device UID check
« Reply #4 on: February 18, 2014, 08:06:42 pm »
HEY! i like trying incompatible software - it's my thing :D

It can be used for all sorts ::)

Offline matthew

  • Mass Poster
  • ****
  • Posts: 1,315
  • Reputation: 13
  • SymphonyOS
  • Current Phone: :
    N8-00 (25.007)
    808 (113.010.1508)
    Retired E72, E6-00
Re: HAL Device UID check
« Reply #5 on: February 18, 2014, 09:07:59 pm »
If this gets implemented, will a forceful install still be possible, or would one have to find a more  'dodgy' way?
i'd estimate 25% of the apps i have installed on the trio are NOT for the device where they now reside ::)
Especially the poor E6 - few love him :(
« Last Edit: February 18, 2014, 09:08:48 pm by matthew »

Offline Allstar12345

  • Allstar Software Founder
  • Administrator
  • Forum Genius
  • ******
  • Posts: 5,235
  • Reputation: 812
    • Allstar Software
  • Current Phone: : OnePlus 8 Pro, Xperia 10, Nexus 6p, Jolla Phone, Nokia N8, Nokia 808 PureView, BlackBerry Z30
Re: HAL Device UID check
« Reply #6 on: February 18, 2014, 09:18:56 pm »
It's nothing to do with install, this runs on App start.

Offline matthew

  • Mass Poster
  • ****
  • Posts: 1,315
  • Reputation: 13
  • SymphonyOS
  • Current Phone: :
    N8-00 (25.007)
    808 (113.010.1508)
    Retired E72, E6-00
Re: HAL Device UID check
« Reply #7 on: February 18, 2014, 09:21:17 pm »
THAT'S EVEN WORSE! :O
Time to falsify my productid with a patch - seems like a good one to start with.

Offline Allstar12345

  • Allstar Software Founder
  • Administrator
  • Forum Genius
  • ******
  • Posts: 5,235
  • Reputation: 812
    • Allstar Software
  • Current Phone: : OnePlus 8 Pro, Xperia 10, Nexus 6p, Jolla Phone, Nokia N8, Nokia 808 PureView, BlackBerry Z30
Re: HAL Device UID check
« Reply #8 on: February 18, 2014, 09:56:19 pm »
THAT'S EVEN WORSE! :O
Time to falsify my productid with a patch - seems like a good one to start with.

Lol would you rather get a working version of an app or a messed version?

Offline matthew

  • Mass Poster
  • ****
  • Posts: 1,315
  • Reputation: 13
  • SymphonyOS
  • Current Phone: :
    N8-00 (25.007)
    808 (113.010.1508)
    Retired E72, E6-00
Re: HAL Device UID check
« Reply #9 on: February 18, 2014, 10:12:32 pm »
Well, if the app won't be released for E6 at all, i would rather have the buggy version and make up my own mind about whether or not to use it.
For example, Nokia Battery Monitor 3.1 is "not" available for E6, but it works all the same (even with the annoying black bars).





It's the same with Sleeping Screen, Bubbles, Connectivity Analyzer, etc. This isn't limited to Nokia, either. i have a load of apps by Offscreen which only show up for nHD devices, but they all work (almost) just fine on VGA. i have the ability to pick which ones i think work well enough and uninstall the ones which are too much of a pain.







And that's what we who have this device have to live with if we want to have some apps that everyone else get.
If you had an E6, you might be able to appreciate this mate.

Edit: i posted no shots of unavailable apps which work perfectly. Those mustn't be excluded in the woes of the E6 userbase.
« Last Edit: February 18, 2014, 10:26:22 pm by matthew »

Offline Allstar12345

  • Allstar Software Founder
  • Administrator
  • Forum Genius
  • ******
  • Posts: 5,235
  • Reputation: 812
    • Allstar Software
  • Current Phone: : OnePlus 8 Pro, Xperia 10, Nexus 6p, Jolla Phone, Nokia N8, Nokia 808 PureView, BlackBerry Z30
Re: HAL Device UID check
« Reply #10 on: February 18, 2014, 10:28:14 pm »
You've really taken this bit of code out of context mate, the dev can do what they like, doesn't mean they will stop the E6 or whatever opening it, I used it to give first gen users a lighter page before.

Ps, you know I appreciate E6 users, otherwise I wouldn't spend hours with property strings and ui tweaking to make Apps E6 compatible.

Offline matthew

  • Mass Poster
  • ****
  • Posts: 1,315
  • Reputation: 13
  • SymphonyOS
  • Current Phone: :
    N8-00 (25.007)
    808 (113.010.1508)
    Retired E72, E6-00
Re: HAL Device UID check
« Reply #11 on: February 18, 2014, 10:31:43 pm »
i wasn't actually aiming this gripe at you so i apologise.
This was more of a bytching session than anything else and it is ironic where it happened.
You are right though; i have once again misunderstood the concept of a code :-X

Offline huellif

  • Developer
  • Christmas Santa
  • ****
  • Posts: 402
  • Reputation: 212
Re: HAL Device UID check
« Reply #12 on: February 20, 2014, 07:53:25 pm »
matthew it's not hard to patch a check like this :P

Offline symster

  • Developer
  • Happy Member
  • ****
  • Posts: 214
  • Reputation: 6
  • Symbian Power User
  • Current Phone: : Nokia N8 Soon Nokia 808
Re: HAL Device UID check
« Reply #13 on: February 20, 2014, 08:52:19 pm »
This conversation is getting weird.A developer want to prevent users from installing app not in target device and a modder want to bypass that by creating a patch.How ironic...???  ;D ;D ;D

Offline Allstar12345

  • Allstar Software Founder
  • Administrator
  • Forum Genius
  • ******
  • Posts: 5,235
  • Reputation: 812
    • Allstar Software
  • Current Phone: : OnePlus 8 Pro, Xperia 10, Nexus 6p, Jolla Phone, Nokia N8, Nokia 808 PureView, BlackBerry Z30
Re: HAL Device UID check
« Reply #14 on: February 20, 2014, 09:29:22 pm »
-_- Last time I'll say this, it can be used for anything, jees even the true return code says do what you want..

Quote
if(checkDevice())
    {
        //Do whatever you please here
    }
« Last Edit: February 20, 2014, 09:48:18 pm by Allstar12345 »