Skip to content

Commit

Permalink
Merge pull request #89 from learningequality/develop
Browse files Browse the repository at this point in the history
Morango node id update into master
  • Loading branch information
jamalex authored Nov 19, 2021
2 parents 03f5e94 + b43882c commit ae4cce6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,26 @@
import re
import sys

from jnius import autoclass
from android_utils import get_activity

script_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(script_dir)
sys.path.append(os.path.join(script_dir, "kolibri", "dist"))
sys.path.append(os.path.join(script_dir, "extra-packages"))

os.environ["DJANGO_SETTINGS_MODULE"] = "kolibri_app_settings"
Secure = autoclass('android.provider.Settings$Secure')

node_id = Secure.getString(
get_activity().getContentResolver(),
Secure.ANDROID_ID
)

# Don't set this if the retrieved id is falsy, too short, or a specific
# id that is known to be hardcoded in many devices.
if node_id and len(node_id) >= 16 and node_id != "9774d56d682e549c":
os.environ["MORANGO_NODE_ID"] = node_id

if pew.ui.platform == "android":
# initialize some system environment variables needed to run smoothly on Android
Expand Down

0 comments on commit ae4cce6

Please sign in to comment.